home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 23 / AMIGAplus Sonderheft 23 (2000)(Falke)(DE)[!].iso / Updates / Librarys / zee_ini_library / include / libraries / ini_lib.h next >
C/C++ Source or Header  |  1999-08-01  |  4KB  |  108 lines

  1. #ifndef LIBRARIES_INI_LIB_H
  2. #define LIBRARIES_INI_LIB_H
  3. /*
  4. **  $VER: ini_lib.h 31.00 (31.10.98)
  5. **
  6. **  Standard C header for ini.library
  7. **
  8. **  (C) Copyright 1996-98 by Basty/Seasons
  9. **      All Rights Reserved
  10. **
  11. */
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include "exec/types.h"
  15. #endif
  16.  
  17. #ifndef EXEC_LISTS_H
  18. #include "exec/lists.h"
  19. #endif
  20.  
  21. #ifndef EXEC_LIBRARIES_H
  22. #include "exec/libraries.h"
  23. #endif
  24.  
  25. #ifndef EXEC_EXECBASE_H
  26. #include "exec/execbase.h"
  27. #endif
  28.  
  29. #ifndef EXEC_DOS_H
  30. #include "dos/dos.h"
  31. #endif
  32.  
  33. /* iniLibBase */
  34. struct iniLibBase {
  35.   struct Library LibNode;
  36.  
  37.   BPTR   SegList;                    /* Segment list */
  38.   struct ExecBase *ExecBase;         /* ExecBase */
  39.   struct DOSBase *DOSBase;           /* DOSBase */
  40.   APTR   MemPool;                    /* Memory pool for iniAllocPMem() */
  41.   struct SignalSemaphore *MemSigSem; /* Memory pool signal semaphore */
  42. }; /* iniLibBase */
  43.  
  44. /* Flags passable to iniReadxxx(), iniGetxxx() and iniFindxxx() */
  45. #define INIB_ContextCase       0L     /* If set, use case sensitive scan for
  46.                                          context names */
  47. #define INIB_ContextItemCase   1L     /* If set, use case sentitive scan for
  48.                                          context item name */
  49.  
  50. #define INIF_ContextCase       (1L<<INIB_ContextCase)
  51. #define INIF_ContextItemCase   (1L<<INIB_ContextItemCase)
  52.  
  53. /* Format parameter of iniIntToStr() */
  54.  
  55. #define INI_FORMAT_DEC         0L     /* Use decimal with no precedor */
  56. #define INI_FORMAT_DEC_CHAR    1L     /* Use decimal with # precedor */
  57. #define INI_FORMAT_HEX         2L     /* Use hexadical with $ precedor */
  58. #define INI_FORMAT_HEX_0X      3L     /* Use hexadical with 0x precedor */
  59. #define INI_FORMAT_BIN         4L     /* Use binary with % precedor */
  60. #define INI_FORMAT_OCT         5L     /* Use octal with & precedor */
  61. #define INI_FORMAT_YESNO       6L     /* Use No for zero, Yes for others */
  62. #define INI_FORMAT_YN          7L     /* Use N for zero, Y for others */
  63. #define INI_FORMAT_TRUEFALSE   8L     /* Use False for zero, True others */
  64. #define INI_FORMAT_ONOFF       9L     /* Use Off for zero, On for others */
  65. #define INI_UNSIGNED    0x80000000    /* Add this to the others to get
  66.                                          unsigned values */
  67.  
  68. /* Floating point format of iniStrToFloat() and iniFloatToStr()
  69.    Upper word: Integer part.
  70.    Lower word: 1/65536 of value.
  71.    Example:
  72.    0x00048000 means 4.5 (0x8000/0x10000 = 0.5)
  73.    0xfffc0000 means -4.0 (if treated as signed)
  74.    0xfffc8000 means -3.5 (if treated as signed) */
  75.  
  76. /* Format parameter of iniFloatToStr() */
  77.  
  78. #define INI_FLOAT_FORMAT_DEC   0L     /* Use decimal with point separator */
  79. #define INI_FLOAT_UNSIGNED     0x80000000 /* Add this to the others to get
  80.                                              unsigned values */
  81.  
  82. /* The following structure is for each file opened by iniOpenFile() or
  83.    iniOpenMem(). */
  84.  
  85. struct iniFile {
  86.   struct MinList Context;             /* Linked list of the contexts. */
  87.   struct MinList PreLines;            /* Lines before the first context. */
  88. };
  89.  
  90. /* The following structure is for each context in the .INI file. */
  91.  
  92. struct iniContext {
  93.   struct MinNode Node;                /* ini.library context chunk */
  94.   struct MinList Lines;               /* Lines belonging to this context */
  95.   STRPTR ContextLine;                 /* Context line */
  96. };
  97.  
  98. /* The following structure is for each line in the .INI file. */
  99.  
  100. struct iniContextItemLine {
  101.   struct MinNode Node;                /* ini.library config line chunk */
  102.   STRPTR Line;                        /* Line contents (incl. CR/LF) */
  103. };
  104.  
  105. #define ININame "ini.library"
  106.  
  107. #endif /* LIBRARIES_INI_LIB_H */
  108.